-
Notifications
You must be signed in to change notification settings - Fork 97
feat: CI - Add code rules checking action #3914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
…EV/GEOS into feat/dudes/add-code-rules
MelReyCG
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you showed that script works, but it seems that there are some critical issues in it.
.github/workflows/ci_tests.yml
Outdated
| # - name: Ubuntu debug (20.04, gcc 10.5.0, open-mpi 4.0.3) - github codespaces | ||
| # CMAKE_BUILD_TYPE: Debug | ||
| # DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc10 | ||
| # BUILD_SHARED_LIBS: ON | ||
| # ENABLE_HYPRE: OFF | ||
| # ENABLE_TRILINOS: ON | ||
| # GEOS_ENABLE_BOUNDS_CHECK: ON | ||
| # HOST_CONFIG: /spack-generated.cmake |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you cannot leave CI modifs aimed for test and request review.
.github/workflows/ci_tests.yml
Outdated
| # - name: Check code rules | ||
| # BUILD_AND_TEST_ARGS: --test-code-rules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it commented out?
scripts/check_code_rules.sh
Outdated
| FULL_FILE_PATTERN="${FILE_PREFIX}${FILE_PATTERNS[*]}" | ||
| # Build the find command | ||
| FIND_CMD="find" | ||
| FIND_FILE_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FILE_PATH_PATTERN seems never initialized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should you add -f?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-type f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beware of template files, they should be included
| /* | |
| * ------------------------------------------------------------------------------------------------------------ | |
| * SPDX-License-Identifier: LGPL-2.1-only | |
| * | |
| * Copyright (c) 2018-2019 Lawrence Livermore National Security LLC | |
| * Copyright (c) 2018-2019 The Board of Trustees of the Leland Stanford Junior University | |
| * Copyright (c) 2018-2019 Total, S.A | |
| * Copyright (c) 2019- GEOSX Contributors | |
| * All right reserved | |
| * | |
| * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. | |
| * ------------------------------------------------------------------------------------------------------------ | |
| */ | |
| /** | |
| * @file @[email protected] | |
| */ | |
| #ifndef GEOS_@KERNEL_GROUP_NAME@_DISPATCHTYPELIST_HPP | |
| #define GEOS_@KERNEL_GROUP_NAME@_DISPATCHTYPELIST_HPP | |
| #include "common/TypeDispatch.hpp" | |
| namespace geos | |
| { | |
| // TODO remove and find a proper solution to namespacing | |
| using namespace constitutive; | |
| using namespace finiteElement; | |
| using @KERNEL_GROUP_NAME@DispatchTypeList = types::TypeList< | |
| @typeCombinationList@ | |
| >; | |
| } // namespace geos | |
| #endif //GEOS_@KERNEL_GROUP_NAME@_DISPATCHTYPELIST_HPP |
scripts/check_code_rules.sh
Outdated
| FILES=$(eval "$FIND_FILE_CMD" 2>/dev/null); | ||
|
|
||
| # Main loop | ||
| for file in $FILES; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does it behave with spaces in folder / file names?
scripts/check_code_rules.sh
Outdated
| ARRAY_UMAP=() | ||
| ARRAY_VECTOR=() | ||
|
|
||
| FULL_FILE_PATTERN="${FILE_PREFIX}${FILE_PATTERNS[*]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure to get that right, but does it result to the following?
src/coreComponents/codingUtilities/* common/* dataRepository/* ...
If yes, how can it work as the file prefix is not added to each file pattern? maybe it would be easier with a cd FILE_PREFIX (rename to VALIDATING_FOLDER?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a missing part to this code..
| print_violation "$MAP_VIOLATIONS_FOUND" ARRAY_MAP "std::map" | ||
| print_violation "$UMAP_VIOLATIONS_FOUND" ARRAY_UMAP "std::unordered_map" | ||
| print_violation "$VECTOR_VIOLATIONS_FOUND" ARRAY_VECTOR "std::vector" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Add an array for them,
- did you missed
std::array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
array still not in GEOS
| <xsd:element name="SinglePhaseHybridFVM" type="SinglePhaseHybridFVMType" /> | ||
| <xsd:element name="SinglePhasePoromechanics" type="SinglePhasePoromechanicsType" /> | ||
| <xsd:element name="SinglePhasePoromechanicsConformingFractures" type="SinglePhasePoromechanicsConformingFracturesType" /> | ||
| <xsd:element name="SinglePhasePoromechanicsConformingFracturesALM" type="SinglePhasePoromechanicsConformingFracturesALMType" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this there ? Branching oddity ?
| --test-code-style | ||
| --test-documentation | ||
| -h | --help | ||
| -h | --help |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe reversible whitespace edition for PR's clarity sake
.github/workflows/ci_tests.yml
Outdated
| - are_submodules_in_sync | ||
| - check_code_style_and_documentation | ||
| - cpu_builds | ||
| - check_code_standards |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If check_code_standards is just rename of check_code_style_and_documentation why ?
And why check_code_rules is not required here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at CI checks, it is indeed then an advisory but not required enforcement ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'll revert that
.github/workflows/ci_tests.yml
Outdated
| needs.check_code_style_and_documentation.result == 'success' && | ||
| needs.cpu_builds.result == 'success' && | ||
| needs.cuda_builds.result == 'success' && | ||
| needs.check_code_standards.result == 'success' && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was need.cpu_builds.results and its cuda counterpart removed while dev to speed up or is it permanent ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was to speed up
scripts/check_code_rules.sh
Outdated
|
|
||
| FULL_FILE_PATTERN="${FILE_PREFIX}${FILE_PATTERNS[*]}" | ||
| # Build the find command | ||
| FIND_CMD="find" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you control distribution and set only POSIX-compliant maybe it is useless to overcomplexify there
scripts/check_code_rules.sh
Outdated
| FULL_FILE_PATTERN="${FILE_PREFIX}${FILE_PATTERNS[*]}" | ||
| # Build the find command | ||
| FIND_CMD="find" | ||
| FIND_FILE_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-type f
| "mesh/*" | ||
| "physicsSolvers/*" | ||
| ) | ||
| EXCLUDE_PATTERNS=( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent ?
scripts/check_code_rules.sh
Outdated
| FULL_FILE_PATTERN="${FILE_PREFIX}${FILE_PATTERNS[*]}" | ||
| # Build the find command | ||
| FIND_CMD="find" | ||
| FIND_FILE_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beware of template files, they should be included
| /* | |
| * ------------------------------------------------------------------------------------------------------------ | |
| * SPDX-License-Identifier: LGPL-2.1-only | |
| * | |
| * Copyright (c) 2018-2019 Lawrence Livermore National Security LLC | |
| * Copyright (c) 2018-2019 The Board of Trustees of the Leland Stanford Junior University | |
| * Copyright (c) 2018-2019 Total, S.A | |
| * Copyright (c) 2019- GEOSX Contributors | |
| * All right reserved | |
| * | |
| * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. | |
| * ------------------------------------------------------------------------------------------------------------ | |
| */ | |
| /** | |
| * @file @[email protected] | |
| */ | |
| #ifndef GEOS_@KERNEL_GROUP_NAME@_DISPATCHTYPELIST_HPP | |
| #define GEOS_@KERNEL_GROUP_NAME@_DISPATCHTYPELIST_HPP | |
| #include "common/TypeDispatch.hpp" | |
| namespace geos | |
| { | |
| // TODO remove and find a proper solution to namespacing | |
| using namespace constitutive; | |
| using namespace finiteElement; | |
| using @KERNEL_GROUP_NAME@DispatchTypeList = types::TypeList< | |
| @typeCombinationList@ | |
| >; | |
| } // namespace geos | |
| #endif //GEOS_@KERNEL_GROUP_NAME@_DISPATCHTYPELIST_HPP |
This PR aim to create a new CI Target in order to ensure the use of the internal tool in geos and to promote the best coding practice.
First, this PR set up the CI
check_code_rulesand will ensure the use of :stdMap,stdUnorderedMap&stdVectorThis PR will be merged after :